var selectedDataRow = '';
//var isInit = true;

//上边选中事件
$("#dataTable").on("click-row.bs.table",function(e,row,ele){
    $("#dataTable .success").removeClass("success");
    $(ele).addClass("success");
    selectedDataRow = row;
});

function loadData() {
    var userName = $('#userName').val();
    var city = $('#city').val();
    var sourceClient = $('#sourceClient').val();
    var sourceBusiness = $('#sourceBusiness').val();
    var status = $('#status').val();
    $('#dataTable').bootstrapTable('refresh', {
        url: basePath + 'bizUserRegistered/pageFindUserData?t=' + new Date().getTime(),
        query: {
            //userName : userName,
            //city : city,
            //sourceClient : sourceClient,
            //sourceBusiness : sourceBusiness,
            status : status
        },
    });
}

function doRefresh(){
    $('#userName').val("");
    $('#city').val("");
    $('#sourceClient').val("");
    $('#sourceBusiness').val("");
    $('#status').val("");

    var userName = $('#userName').val();
    var city = $('#city').val();
    var sourceClient = $('#sourceClient').val();
    var sourceBusiness = $('#sourceBusiness').val();
    var status = $('#status').val();
    $('#dataTable').bootstrapTable('refresh', {
        url: basePath + 'bizUserRegistered/pageFindUserData?t=' + new Date().getTime(),
        query: {
            //userName : userName,
            //city : city,
            //sourceClient : sourceClient,
            //sourceBusiness : sourceBusiness,
            status : status
        },
    });
}

$(function () {
    window.actionEvents = {
        'click .infoView': function (e, value, row, index) {
            //编辑操作
            selectedDataRow = row;
            doCheck();
        },
    }
});

function doCheck() {
    if (!selectedDataRow || selectedDataRow == '') {
        toastr.error(common_no_choose_msg.format("操作"));
        return;
    }
    openPage( selectedDataRow.id);
}

function doExport() {
    $('#searchForm').attr("action",basePath+"bizUserRegistered/exportDataExcel");
    $('#searchForm').submit();
}

function openPage(id) {
    var tableOptions = $('#dataTable').bootstrapTable('getOptions', null);
    window.location.href = basePath + 'bizUserRegistered/checkUserRegistered?&id=' + id + '&t=' + new Date().getTime() +
       '&pageNo=' + tableOptions.pageNumber + '&pageSize=' + tableOptions.pageSize;
}